﻿using System;
using System.Net;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Documents;
using System.Windows.Ink;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Animation;
using System.Windows.Shapes;
using System.ComponentModel.DataAnnotations;
using SilveR.Views.StatsViews;

namespace SilveR.GUIValidators
{
    public class GraphicalAnalysisGUIValidator
    {
        public static ValidationResult CheckStringVarSet(string variable, ValidationContext context)
        {
            return BasicGUIValidator.CheckStringVarSet(variable, context);
        }

        public static ValidationResult ValidateXAxis(string variable, ValidationContext context)
        {
            GraphicalVariables ga = (GraphicalVariables)context.ObjectInstance;

            if (String.IsNullOrEmpty(variable) && (ga.ScatterplotSelected || ga.BoxplotSelected || ga.SEMPlotSelected || ga.CaseProfilesPlotSelected))
                return new ValidationResult("X-axis variable required for all plots except histogram");
            else
                return ValidationResult.Success;
        }

        public static ValidationResult ValidateCaseIDFactor(string variable, ValidationContext context)
        {
            GraphicalVariables ga = (GraphicalVariables)context.ObjectInstance;

            if (String.IsNullOrEmpty(variable) && ga.CaseProfilesPlotSelected)
                return new ValidationResult("Case ID variable required to produce Case Profiles Plot");
            else
                return ValidationResult.Success;
        }
    }
}